package com.zy.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zy.system.mapper.SysUserRoleMapper;
import com.zy.system.domain.SysUserRole;
import com.zy.system.service.ISysUserRoleService;
import com.zy.common.support.Convert;

/**
 * 用户和角色关联 服务层实现
 * 
 * @author zy
 * @date 2018-12-19
 */
@Service
public class SysUserRoleServiceImpl implements ISysUserRoleService 
{
	@Autowired
	private SysUserRoleMapper sysUserRoleMapper;

	/**
     * 查询用户和角色关联信息
     * 
     * @param userId 用户和角色关联ID
     * @return 用户和角色关联信息
     */
    @Override
	public SysUserRole selectSysUserRoleById(Integer userId)
	{
	    return sysUserRoleMapper.selectSysUserRoleById(userId);
	}
	
	/**
     * 查询用户和角色关联列表
     * 
     * @param sysUserRole 用户和角色关联信息
     * @return 用户和角色关联集合
     */
	@Override
	public List<SysUserRole> selectSysUserRoleList(SysUserRole sysUserRole)
	{
	    return sysUserRoleMapper.selectSysUserRoleList(sysUserRole);
	}
	
    /**
     * 新增用户和角色关联
     * 
     * @param sysUserRole 用户和角色关联信息
     * @return 结果
     */
	@Override
	public int insertSysUserRole(SysUserRole sysUserRole)
	{
	    return sysUserRoleMapper.insertSysUserRole(sysUserRole);
	}
	
	/**
     * 修改用户和角色关联
     * 
     * @param sysUserRole 用户和角色关联信息
     * @return 结果
     */
	@Override
	public int updateSysUserRole(SysUserRole sysUserRole)
	{
	    return sysUserRoleMapper.updateSysUserRole(sysUserRole);
	}

	/**
     * 删除用户和角色关联对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteSysUserRoleByIds(String ids)
	{
		return sysUserRoleMapper.deleteSysUserRoleByIds(Convert.toStrArray(ids));
	}
	
}
